package com.zl.roomdesign.auth

import android.arch.lifecycle.MutableLiveData
import com.zl.core.api.ServiceGenerator
import com.zl.core.base.BaseViewModel
import com.zl.core.db.user.User
import com.zl.core.extend.appSubscribe

/**
 * Created by zhangli on 2018/5/5,19:54<br/>
 */
class RegisterViewModel : BaseViewModel() {

    private val TAG = "RegisterViewModel"

    private val mService = ServiceGenerator.createRxService(AuthService::class.java)

    var registerSuccess: MutableLiveData<Boolean> = MutableLiveData()

    fun register(phone: String, pwd: String) {
        mService.register(User(phone.toLong(), pwd, "用户$phone"))
                .appSubscribe(this, {
                    registerSuccess.postValue(true)
                })

    }

}